package com.zhengx.moduletest.base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zhengx.baselib.base.IBaseView;


/**
 * name：BaseFragmentDialog
 * class: describe
 * author: zhengx
 * create_time: 2018/11/21
 */
public abstract class BaseFragmentDialog extends DialogFragment implements IBaseView {

    public Context context;

    private View mContentView;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.context = context;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        int layoutRes = setContentView();
        View view = inflater.inflate(layoutRes, container, false);
        mContentView = view;
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        Bundle bundle = getArguments();
        initArgData(bundle);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        bindView(savedInstanceState, mContentView);
        doBusiness();
    }
}
